//系统配置-操作分组
App.pages.add((function(){
    var NS = Admin.Access.OperationGroup;
    var page = new App.Page({
        name: 'access/operationGroup/index'
    });
    //页面初始化
    page.initStack.add('dataTable', function(){
        //面包屑导航
        this.setBreadcrumb([{
            icon: '<i class="fa fa-folder"></i>',
            content: '系统配置'
        }, {
            content: '操作分组'
        }]);
        this.dataTable = new App.DataTable({
            baseUrl: '/admin/access/operationGroup',
            dataUrl: 'lists',
            table: {
                id: 'group_id',
                main: 0,
                columns: App.util.copy(NS.Conf.columns)
            },
            filter: [
                {type: 'keywords'},
                {type: 'select', title: '权限类型', name: 'type', width: '100px', items: [
                    [1, '操作'],
                    [2, '数据']
                ]}
            ],
            menu: [
                {parent: 'add', permission: 'op:admin.access.operationGroup.create'},
                {parent: 'view', permission: 'op:admin.access.operationGroup.detail'},
                {parent: 'edit', permission: 'op:admin.access.operationGroup.update'},
                {parent: 'drop', permission: 'op:admin.access.operationGroup.delete'},
                {parent: 'multiDrop', permission: 'op:admin.access.operationGroup.multiDelete'}
            ],
            detail: {
                form: {
                    items: App.util.copy(NS.Conf.form)
                }
            },
            afterChange: function(){
                App.models.get('operationGroups').refresh();
            }
        }, page);
        this.dataTable.fix(this.contentContainer);
        this.dataTable.loadData();
    });
    //页面刷新
    page.refreshStack.add('dataTable', function(){
        this.dataTable.loadData(true);
    });
    //页面销毁
    page.destroyStack.add('dataTable', function(){
        this.dataTable.destroy();
    });
    return page;
})());